package com.wsj.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.wsj.dao.IHomeSiteAdBannerDescriptDao;
import com.wsj.service.IHomeSiteAdBannerDescriptServ;
import com.wsj.util.exception.BusinessException;
import com.wsj.util.page.PageResultSet;
import com.wsj.util.tool.StringUtils;
import com.wsj.web.vo.homeSite.HomeSiteAdBannerDescription;

public class HomeSiteAdBannerDescriptServImpl implements
		IHomeSiteAdBannerDescriptServ {

	private IHomeSiteAdBannerDescriptDao homeSiteAdBannerDescriptDao;
	
	public void add(HomeSiteAdBannerDescription hsd) throws BusinessException {
		if(hsd!=null){
			this.homeSiteAdBannerDescriptDao.add(hsd);
		}
	}

	public void delete(HomeSiteAdBannerDescription hsd) throws BusinessException {
		if(hsd!=null){
			this.homeSiteAdBannerDescriptDao.delete(hsd);
		}
	}

	public List loadByNewsClassId(Long newsClassId) throws BusinessException {
		List list = new ArrayList();
			list = this.homeSiteAdBannerDescriptDao.loadByNewsClassId(newsClassId);
		return list;
	}

	public HomeSiteAdBannerDescription loadHsAdBannerById(Integer id) throws BusinessException {
		return this.homeSiteAdBannerDescriptDao.loadHsAdBannerById(id);
	}

	public void update(HomeSiteAdBannerDescription hsd) throws BusinessException {
		if(hsd!=null){
			this.homeSiteAdBannerDescriptDao.update(hsd);
		}
	}

	public PageResultSet loadPageList(Long newsClassId,String description,Integer page, Integer pageSize) throws BusinessException {
		return homeSiteAdBannerDescriptDao.loadPageList(newsClassId, description, page, pageSize);
	}
	

	public IHomeSiteAdBannerDescriptDao getHomeSiteAdBannerDescriptDao() {
		return homeSiteAdBannerDescriptDao;
	}

	public void setHomeSiteAdBannerDescriptDao(
			IHomeSiteAdBannerDescriptDao homeSiteAdBannerDescriptDao) {
		this.homeSiteAdBannerDescriptDao = homeSiteAdBannerDescriptDao;
	}

	public HomeSiteAdBannerDescription loadByClassIdAndName(Long classId, String name) throws BusinessException {
		if(StringUtils.isNotNull(name) && classId != null){
			return this.homeSiteAdBannerDescriptDao.loadByClassIdAndName(classId, name);
		}
		return null;
	}

		
	
}
